//---------------------------------------------------------------------------

#ifndef uCerfaH
#define uCerfaH
#include "s:\autres\editeur_de_cerfas\device.h"

//---------------------------------------------------------------------------
class TCerfa{
    private :
        AnsiString m_File;
        bool       m_CerfaFileEOF;
        HANDLE     m_hCerfaFile;
        TCanvas    *m_Canvas;
        TCoorRect  m_Rc;
        TCoorPoint m_PtOrigin;
        TList      *m_ListOfPushedFont;
        TList      *m_ListOfPushedSizeDeciPoint;
        int        m_xDroit, m_Gauche;
        int        m_nLastSizeDeciPoint;
        HFONT      m_hFont, m_hOldFont, m_hFontEcran, m_hOldFontEcran;
        LOGFONT    m_lf;
        HDC        m_hDCRefCerfa;

        void __fastcall ReadFile( LPVOID lpBuffer, DWORD nNumberOfBytesToRead);
        void __fastcall ReadArg( int Num, short *pnArg, int nLongArg, long *plArg, int nStrArg, char **ppStrArg, char *szBuf, int nSizeOfBuf);
        void __fastcall ReadFields();

        void __fastcall VLine( int x, int yTop, int yBottom);
        void __fastcall HLine( int y, int xLeft, int xRight);
        void __fastcall Cadre( int xLeft, int yTop, int xRight, int yBottom);
        void __fastcall Rectangle( int xLeft, int yTop, int xRight, int yBottom,
                                   enum GRISE_DE_RECTANGLE eGrise);
        void __fastcall FlecheOut( int xDepart, int yDepart, int nLongueurTotale,
                                   int nLargeurBout, int nDemiHauteurBout);
        void __fastcall Panneau( int xLeft, int yTop, int xRightAvantFleche,
                                 int yBottom, int nLongueurFleche );

        void __fastcall BmpOut(        int xLeft, int yTop, int NbOctetsLarg, int NbLignes);
        void __fastcall BmpOutInverse( int xLeft, int yTop, int NbOctetsLarg, int NbLignes);
        void __fastcall BmpOutGrisDur( int xLeft, int yTop, int NbOctetsLarg, int NbLignes);
        void __fastcall BmpOutEx(      int xLeft, int yTop, int NbOctetsLarg, int NbLignes, COLORREF cr);
        void __fastcall MyBmpOut(      int xLeft, int yTop, int NbOctetsLarg, int NbLignes,
                                       RGBQUAD argbq[], int Op);

        void __fastcall DottedLine( int y, int xLeft, int xRight, enum DOTTED_LINE_STYLE eStyle);
        void __fastcall PastilleOut( int xLeft, int yBaseText, const char* pcszText, int bIsBlack);

        void __fastcall TextOutReduit( int x, int y, const char *pcszTxt, int Echelle);
        void __fastcall CapitalOut( int x, int y, int nUpSize, int nLoSize, const char *pcszTxt);
        void __fastcall TextOut( int x, int y, const char *pcszTxt);
        void __fastcall GetFont( LOGFONT *lf);
        void __fastcall SetFont( const LOGFONT *lf);
        void __fastcall FontStyle( enum FONT_STYLE eStyle);
        void __fastcall FontSize( int nSize);
        void __fastcall FontItalic( int bItalic);
        void __fastcall FontWeight( int eWeight );
        void __fastcall FontOrientation( int Orientation);
        void __fastcall SetFont();
        void __fastcall PushFont( void);
        void __fastcall PopFont( void);
        void __fastcall CaseACocher( int xLeft, int yBaseLine, const char* pcszTextInto /* = NULL */);

        void __fastcall WhiteText();
        void __fastcall BlackText();
        void __fastcall ColorTextAndBk(enum GRISE_DE_RECTANGLE eTextColor, enum GRISE_DE_RECTANGLE eBkColor);
        void __fastcall TextOutV( int xBottom, int yLeft, const char *pcszTxt);
        void __fastcall TextOutBiais( int xBottom, int yLeft, const char *pcszTxt);


        int  __fastcall CX( int);
        int  __fastcall CY( int);

    public :
        __fastcall TCerfa( const AnsiString &File);
        virtual __fastcall ~TCerfa( );
        void Draw( TCanvas *canvas, int nPage, const TCoorRect &_Rc, const TCoorPoint *PtOrig);
};
#endif
